<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateBasicCollectTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('basic_collect', function (Blueprint $table) {
            $table->increments('id');
            $table->tinyInteger('site_id', false, true)->default(0)->comment('站点编号 默认 0:单站点;');
            $table->integer('uid', false, true)->default(0)->comment('收藏人编号');
            $table->char('object_model')->nullable()->comment('模型名称');
            $table->char('object_id')->default(0)->comment('数据编号');
            $table->char('ip', 15)->nullable()->comment('ip地址');
            $table->text('more')->nullable()->comment('扩展字段');
            $table->unique(['site_id', 'uid', 'object_model', 'object_id', 'ip']);
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('basic_collect');
    }
}
